home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 176 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: dawn.mmm.com!news
  2. From: kjhopps@mmm.com (Kevin J Hopps)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Exceptions vs. assertions
  5. Date: 2 Jan 1996 14:33:07 GMT
  6. Organization: 3M - St. Paul, MN  55144-1000 US
  7. Message-ID: <4cbfn3$kst@dawn.mmm.com>
  8. References: <4al1hn$73e@news.nstn.ca> <4bpt9b$cb5@news2.ios.com> <4bqb7t$bca@sundog.tiac.net> <4bsjqi$2t1k@tigger.cc.uic.edu>
  9. Reply-To: kjhopps@mmm.com
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Thadeus Olczyk (olczyk@sunphy1) wrote:
  13. > Chris Page (page@tiac.net) wrote:
  14. > : Exceptions do not cost anything until you use them.  My rule of thumb
  15. > : is this: If I expect a condition to occur during normal operation of
  16.  
  17. > Exceptions do cost, even if you don't use them. In fact one criteria of
  18. > quality of C++ compilers is the amount of overhead they incur for uncaught 
  19. > exceptions.
  20.  
  21. There are at least two kinds of cost to be considered -- time and space.
  22. For all the compilers I have investigated, it appears that they have traded
  23. space in favor of time -- executables using exceptions are larger than their
  24. return-value equivalents.
  25.  
  26. As for time, the performance of exception throwing code versus equivalent
  27. error-returning code is nearly the same (for the systems I have checked) when
  28. no errors occur.
  29.  
  30. As for the overhead incurred for uncaught exceptions, I think it does not
  31. matter, since the program will terminate anyway.
  32. --
  33. Kevin J. Hopps                  e-mail: kjhopps@mmm.com
  34. 3M Company                      phone:  (612) 737-4643
  35. 3M Center, Bldg. 235-2D-57      fax:    (612) 737-2700
  36. St. Paul, MN 55144-1000         Opinions are my own.  I don't speak for 3M.
  37.     But 3M speaks for me -- I did not write the following line:
  38.  
  39. Opinions expressed herein are my own and may not represent those of 3M.
  40.